#ifndef _GET_PIECES_H_
#define _GET_PIECES_H_

#include "structure.h"

typedef int gp_file; // descripteur de fichier dans la base de donnée db

typedef long long _t_buffermap ;

struct down_args{
   struct client * cl;
   _t_buffermap  bm;
   int gp_file ;
};


void get_pieces_func(void * v_gp_file);
int choosePieces(const struct file * f, const struct client * peer, const int n, _t_buffermap * pieces);
int choose(int gp_file, struct client ** cl, _t_buffermap * pieces);
void pthread_join_all(pthread_t *t, int size);
_t_buffermap intBufToBM(int*, size_t, _t_buffermap);
short BM_isSet(size_t i, _t_buffermap m);

#endif
